﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MenuApplication
{
    public partial class MenuForm : Form
    {
        private FormIndialog inDialog = new FormIndialog();
        private IntegerData id = new IntegerData();
        public IntegerData Id
        {
            get { return id; }
            set { id = value; }
        }

        public MenuForm()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void readToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(inDialog.ShowDialog() == DialogResult.OK)
            {
                Id.Data = inDialog.Id.Data;
                Id.Init = inDialog.Id.Init;
            }
        }

        private void writeToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (Id.Init)
            {
                MessageBox.Show(Id.ToString(), "Inmatat", MessageBoxButtons.OK, MessageBoxIcon.Information); 
            }
            else
            {
                MessageBox.Show("Uninitialized value!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
